﻿package frEngine.effectEditTool.temple
{
    import __AS3__.vec.*;
    import baseEngine.core.*;
    import baseEngine.system.*;
    import flash.geom.*;
    import frEngine.core.*;
    import frEngine.core.mesh.*;
    import frEngine.effectEditTool.manager.*;
    import frEngine.primitives.lightingline.bullet.*;

    public class TempleLighting extends Object implements ITemple
    {
        private var _container:Obj3dContainer;
        private var _fighter:Md5Mesh;
        private var _fighted:Vector.<Md5Mesh>;
        private var _lighting:LightingLine;

        public function TempleLighting(param1:Obj3dContainer)
        {
            this._fighted = new Vector.<Md5Mesh>;
            this._container = param1;
            return;
        }// end function

        public function get targetRole() : Pivot3D
        {
            return this._fighter;
        }// end function

        private function setFightParams(param1:Md5Mesh, param2:Vector.<Md5Mesh>) : void
        {
            this._fighter = param1;
            this._fighted = param2;
            return;
        }// end function

        public function setTempleParams(param1) : void
        {
            this.setFightParams(param1[0], param1[1]);
            return;
        }// end function

        public function parsersParams(param1) : void
        {
            var _loc_4:Object = null;
            if (!this._lighting)
            {
                this._lighting = new LightingLine("case", false, Global3D.scene.renderLayerList);
                this._lighting.timerContorler = this._container.timerContorler;
                Global3D.scene.addChild(this._lighting);
            }
            if (!param1)
            {
                return;
            }
            if (param1.lineTexture && param1.lineTexture != "")
            {
                this._lighting.setMaterial(param1.lineTexture, 0, param1.lineTexture);
            }
            this._lighting._lineType = param1.lineType + 1;
            this._lighting._width = param1.lineWidth;
            this._lighting._textureLength = param1.textureLength;
            this._lighting.lineStep = param1.lineStep < 5 ? (5) : (param1.lineStep);
            this._lighting._timeFactor = param1.timeFactor;
            this._lighting._amplitude0 = param1.amplitude0;
            this._lighting._frequency0 = param1.frequency0;
            this._lighting._amplitude1 = param1.amplitude1;
            this._lighting._frequency1 = param1.frequency1;
            this._lighting._maxFlyTime = param1.maxFlyTime / Global3D.animateSpeedFrame;
            this._lighting._jumpFactor = param1.jumpFactor;
            this._lighting.setMateiralBlendMode(param1.blendType ? (param1.blendType.value) : (EBlendType.BLEND_NONE), param1.sourceFactor, param1.destFactor);
            var _loc_2:* = param1.startPoint;
            var _loc_3:* = param1.endPoint;
            if (_loc_2)
            {
                this._lighting.startBoneName = _loc_2[0];
                _loc_4 = _loc_2[2];
                this._lighting.startOffset = new Vector3D(_loc_4.x, _loc_4.y, _loc_4.z);
            }
            if (_loc_3)
            {
                this._lighting.endBoneName = _loc_3[0];
                _loc_4 = _loc_3[2];
                this._lighting.endOffset = new Vector3D(_loc_4.x, _loc_4.y, _loc_4.z);
            }
            return;
        }// end function

        public function unHangAll(param1:Pivot3D, param2:Boolean = false) : void
        {
            return;
        }// end function

        public function checkAndPlay() : void
        {
            if (this._lighting && this._fighter && this._fighted && this._fighted.length > 0)
            {
                this._lighting.ReSetup(this._fighter, this._fighted);
                this._lighting.playing = true;
            }
            return;
        }// end function

        public function dispose(param1:Pivot3D) : void
        {
            if (this._lighting)
            {
                this._lighting.dispose();
                this._lighting = null;
            }
            return;
        }// end function

        public function getMeshByUid(param1:String) : Pivot3D
        {
            return null;
        }// end function

        public function update() : void
        {
            return;
        }// end function

    }
}
